package com.egao.orderB.service.impl;

import com.egao.common.core.damon.results.PageResult2;
import com.egao.common.core.web.JsonResult;
import com.egao.common.system.entity.User;
import com.egao.orderB.biz.OtherFeeBiz;
import com.egao.orderB.entity.OtherFee;
import com.egao.orderB.service.OtherFeeService;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

//import com.egao.orderB.mapper.OtherFeeMapper;
//import javax.transaction.Transactional;

/**
 * 其他表的费用服务实现类
 * @author : Doman
 * @date : 2021-11-17 15:26:59
 * @version ：1.0
 */
@Service
public class OtherFeeServiceImpl /*extends ServiceImpl<OtherFeeMapper, OtherFee> */implements OtherFeeService {

	@Autowired
	private OtherFeeBiz otherFeeBiz;

  @Override
  public JsonResult list(PageResult2<T> page, OtherFee otherFee, User loginUser)  throws Exception{
    return otherFeeBiz.list(page,otherFee,loginUser);
  }

  @Override
  public JsonResult list(OtherFee otherFee, User loginUser) {
    return JsonResult.ok().setData(otherFeeBiz.list(otherFee,loginUser));
  }

  @Override
  public JsonResult getById(OtherFee otherFee) {
    return JsonResult.ok().setData(otherFeeBiz.getById(otherFee));
  }

  @Transactional
  @Override
  public JsonResult save(OtherFee otherFee, User loginUser) {
    if (otherFeeBiz.save(otherFee, loginUser)) {
      return JsonResult.ok("添加成功");
    }
    return JsonResult.error("添加失败");
  }

  @Transactional
  @Override
  public JsonResult update(OtherFee otherFee, User loginUser) {
    if (otherFeeBiz.update(otherFee, loginUser)) {
      return JsonResult.ok("修改成功");
    }
    return JsonResult.error("修改失败");
  }

  @Transactional
  @Override
  public JsonResult remove(OtherFee otherFee, User loginUser) {
    if (otherFeeBiz.remove(otherFee, loginUser)) {
      return JsonResult.ok("删除成功");
    }
    return JsonResult.error("删除失败");
  }

}
